package org.breathe.thread.pool.common.enums;

import lombok.Getter;

/**
 * @author: breathe
 * @createTime: 2025-05-19
 */
@Getter
public enum NotifyItemEnum {

    /**
     * 配置改变通知
     */
    CHANGE("change"),

    /**
     * 线程池存货通知
     * liveness = activeCount / maximumPoolSize
     */
    LIVENESS("liveness"),

    /**
     * 容量通知
     */
    CAPACITY("capacity"),

    /**
     * 拒绝通知 notify.
     */
    REJECT("reject"),

    /**
     * 任务超时警告
     */
    RUN_TIMEOUT("run_timeout"),

    /**
     * 任务队列超时警告
     */
    QUEUE_TIMEOUT("queue_timeout");

    private final String value;

    NotifyItemEnum(String value) {
        this.value = value;
    }

    public static NotifyItemEnum of(String value) {
        for (NotifyItemEnum notifyItem : NotifyItemEnum.values()) {
            if (notifyItem.value.equals(value)) {
                return notifyItem;
            }
        }
        return null;
    }
}

